#include "scence_cmd.hpp"

namespace cmd
{
	void CSMJ2EnterRoomReq::serialize(Streamer & streamer)
	{
		CSHead::serialize(streamer);
		streamer & _area_id
			     & _room_id;
	}

	const std::string CSMJ2EnterRoomReq::to_string() const
	{
		std::ostringstream oss;
		oss << CSHead::to_string()
			<< " body: {area_id: " << (int)_area_id
			<< ", room_id: " << (int)_room_id
			<< "}";
		return oss.str();
	}

	void SCMJ2EnterRoomRes::serialize(Streamer & streamer)
	{
		SCHead::serialize(streamer);
		streamer & _position
			     & _role_list;
	}

	const std::string SCMJ2EnterRoomRes::to_string() const
	{
		std::ostringstream oss;
		oss << SCHead::to_string()
			<< " body: {position: " << _position.to_string()
			<< ", role list size: " << _role_list.size()
			<< "}";
		return oss.str();
	}

	void SSMJ2EnterRoomReq::serialize(Streamer & streamer)
	{
		SSHead::serialize(streamer);
		streamer & _room_id
			     & _role_b;
	}

	const std::string SSMJ2EnterRoomReq::to_string() const
	{
		std::ostringstream oss;
		oss << SSHead::to_string()
			<< " body: {room_id: " << (int) _room_id
			<< ", role_b: " << _role_b.to_string()
			<< "}";
		return oss.str();
	}

	void SCNotifyMJ2EnterRoom::serialize(Streamer & streamer)
	{
		SCNotify::serialize(streamer);
		streamer & _role_b;
	}

	const std::string SCNotifyMJ2EnterRoom::to_string() const
	{
		std::ostringstream oss;
		oss << SCNotify::to_string()
			<< " body: {rid: " << _role_b._id
			<< "}";
		return oss.str();
	}

	void SCMJ2GetCardRes::serialize(Streamer & streamer)
	{
		SCHead::serialize(streamer);
		streamer & _card;
	}

	const std::string SCMJ2GetCardRes::to_string() const
	{
		std::ostringstream oss;
		oss << SCHead::to_string()
			<< " body: {card: " << _card.to_string()
			<< "}";
		return oss.str();
	}

	void CSMJ2PutCardReq::serialize(Streamer & streamer)
	{
		CSHead::serialize(streamer);
		streamer & _card;
	}

	const std::string CSMJ2PutCardReq::to_string() const
	{
		std::ostringstream oss;
		oss << CSHead::to_string()
			<< " body: {card: " << _card.to_string()
			<< "}";
		return oss.str();
	}

	void SCNotifyMJ2PutCard::serialize(Streamer & streamer)
	{
		SCNotify::serialize(streamer);
		streamer & _other_rid
			     & _card;
	}

	const std::string SCNotifyMJ2PutCard::to_string() const
	{
		std::ostringstream oss;
		oss << SCNotify::to_string()
			<< " body: {other_rid: " << _other_rid
			<< ", card: " << _card.to_string()
			<< "}";
		return oss.str();
	}
	
	void CSMJ2ChiReq::serialize(Streamer & streamer)
	{
		CSHead::serialize(streamer);
		streamer & _card[0]
				 & _card[1];
	}

	const std::string CSMJ2ChiReq::to_string() const
	{
		std::ostringstream oss;
		oss << CSHead::to_string()
			<< " body: {card[0]: " << _card[0].to_string()
			<< ", card[1]: " << _card[1].to_string()
			<< "}";
		return oss.str();
	}

	void SCMJ2ChiRes::serialize(Streamer & streamer)
	{
		SCHead::serialize(streamer);
		streamer & _card[0]
				 & _card[1]
				 & _card[2];
	}

	const std::string SCMJ2ChiRes::to_string() const
	{
		std::ostringstream oss;
		oss << SCHead::to_string()
			<< " body: {card[0]: " << _card[0].to_string()
			<< ", card[1]: " << _card[1].to_string()
			<< ", card[2]: " << _card[2].to_string()
			<< "}";
		return oss.str();
	}

	void SCNotifyMJ2Chi::serialize(Streamer & streamer)
	{
		SCNotify::serialize(streamer);
		streamer & _other_rid
			     & _card[0]
				 & _card[1]
				 & _card[2];
	}

	const std::string SCNotifyMJ2Chi::to_string() const
	{
		std::ostringstream oss;
		oss << SCNotify::to_string()
			<< " body: {other_rid: " << _other_rid
			<< ", card[0]: " << _card[0].to_string()
			<< ", card[1]: " << _card[1].to_string()
			<< ", card[2]: " << _card[2].to_string()
			<< "}";
		return oss.str();
	}
};

